package vh.android.multiconnector.quiz;

import vh.android.multiconnector.quiz.models.GameAnswer;
import vh.android.multiconnector.quiz.ui.adapters.QuestionAdapter;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class QuestionActivity extends FragmentActivity implements
		OnItemClickListener {

	private GameAnswer[] mAnswers = new GameAnswer[] {};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_question);

		ListView lvAnswers = (ListView) findViewById(R.id.lvAnswers);
		lvAnswers.setOnItemClickListener(this);
		QuestionAdapter adapter = new QuestionAdapter(getApplicationContext());
		mAnswers = new GameAnswer[] {};
		adapter.addAll(mAnswers);
		lvAnswers.setAdapter(adapter);
	}

	@Override
	public void onItemClick(AdapterView<?> view, View itemView, int index,
			long arg3) {
		GameAnswer answer = mAnswers[index];
		// TODO is answer correct
		// TODO broadcast that user has selected an answer
	}
}
